<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-on指令</title>
</head>
<body>
    <div id="app">
        <button v-on:click="addOne">加1</button>
        <button v-on:click="addTen">加10</button>
        <input type="text" placeholder="增加的数量" v-model="add"><button v-on:click="addNum">自定义增加</button>
        <p>{{ number }}</p>
    </div>
</body>
<script src="vue.js"></script>
<script>
    new Vue({
        el: "#app",
        data: {
            number: 0,
            add: 0
        },
        // 事件
        methods: {
            addOne: function() {
                this.number = this.number + 1;
            },
            addTen: function() {
                this.number = this.number + 10;
            },
            addNum: function() {
                this.number = this.number + parseInt(this.add)
            }
        }
    })
</script>
</html>